home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / comm1 / remotebt.lha / RemoteBoot13.c < prev   
C/C++ Source or Header  |  1996-03-06  |  2KB  |  120 lines

  1. /*
  2. ** Remote booter Version 1.00 (OS1.3 Version)
  3. ** By The Reaper
  4. **
  5. ** © 1996 Eden Software
  6. */
  7.  
  8. #define Prototype extern
  9.  
  10. #include <exec/types.h>
  11. #include <dos/dos.h>
  12.  
  13. #include <clib/dos_protos.h>
  14.  
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18.  
  19. /* Globals */
  20. char *s;
  21. char *c;
  22. char *devs;
  23. char *libs;
  24. char *sys;
  25. char *l;
  26. char *t;
  27. char *boot;
  28.  
  29. /* Prototypes */
  30. Prototype void ReadConfig(void);
  31. Prototype void DoBoot(void);
  32.  
  33. main()
  34. {
  35.     printf("RemoteBoot (OS1.3+ Version) Version 1.00 by The Reaper\n\n");
  36.  
  37.     ReadConfig();
  38. #ifndef DEBUG
  39.     DoBoot();
  40. #else
  41.     printf("%s\n", s);
  42.     printf("%s\n", c);
  43.     printf("%s\n", l);
  44.     printf("%s\n", devs);
  45.     printf("%s\n", libs);
  46.     printf("%s\n", t);
  47. #endif
  48.     return(0);
  49. }
  50. void ReadConfig(void)
  51. {
  52.     FILE *fp;
  53.     char buf[256];
  54.     char *tmp;
  55.     
  56.     if(fp = fopen("s:Boot.cfg", "r"))
  57.     {
  58.         while(!feof(fp))
  59.         {
  60.             fgets(buf, sizeof(buf), fp);
  61.             
  62.             tmp = strtok(buf, "=");
  63.             
  64.             if(strcmp(tmp, "S") == NULL)
  65.                 s = strdup(strtok(NULL, "\n"));
  66.             
  67.             if(strcmp(tmp, "C") == NULL)
  68.                 c = strdup(strtok(NULL, "\n"));
  69.             
  70.             if(strcmp(tmp, "L") == NULL)
  71.                 l = strdup(strtok(NULL, "\n"));
  72.             
  73.             if(strcmp(tmp, "LIBS") == NULL)
  74.                 libs = strdup(strtok(NULL, "\n"));
  75.             
  76.             if(strcmp(tmp, "DEVS") == NULL)
  77.                 devs = strdup(strtok(NULL, "\n"));
  78.             
  79.             if(strcmp(tmp, "SYS") == NULL)
  80.                 sys = strdup(strtok(NULL, "\n"));
  81.             
  82.             if(strcmp(tmp, "T") == NULL)
  83.                 t = strdup(strtok(NULL, "\n"));
  84.             
  85.             if(strcmp(tmp, "BOOT") == NULL)
  86.                 boot = strdup(strtok(NULL, "\n"));
  87.         }
  88.         
  89.         fclose(fp);
  90.     }
  91. }
  92. void DoBoot(void)
  93. {
  94.     printf("Booting...\n");
  95.     
  96.     char exe[256];
  97.     
  98.     sprintf(exe, "Assign S: %s", s);
  99.     system(exe);
  100.     
  101.     sprintf(exe, "Assign C: %s", c);
  102.     system(exe);
  103.     
  104.     sprintf(exe, "Assign L: %s", l);
  105.     system(exe);
  106.     
  107.     sprintf(exe, "Assign T: %s", t);
  108.     system(exe);
  109.     
  110.     sprintf(exe, "Assign SYS: %s", sys);
  111.     system(exe);
  112.     
  113.     sprintf(exe, "Assign DEVS: %s", devs);
  114.     system(exe);
  115.     
  116.     sprintf(exe, "Assign LIBS: %s", libs);
  117.     system(exe);
  118.     
  119.     system(boot);
  120. }